<?php
require_once 'config.php';
$link=mysql_connect(DATABASE_ADDRESS, DATABASE_USER, DATABASE_PASS);
mysql_select_db(DATABASE_NAME);
include("include.php");


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Bodji's Jokes</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" href="style.css" type="text/css" />	
	<link rel="icon" type="image/png" href="img/favicon.ico" />
	<link rel="alternate" type="application/rss+xml" title="Jokes" href="index.php?page=rss" />
	<script type="text/javascript" src="fonction.js"></script> 	
</head>
<body>
<div id="all">
	<div id="banniere" >
	</div>
	<div id="menu">
	<ul>
		<li><a href="./index.php?sort=latest">Acceuil(<?php print Joke::getNumberJoke();?> jokes)</a></li>
		<li><a href="./index.php?page=addjoke">Add Joke</a></li>
		<li><a href="./index.php?sort=top">Top</a></li>
		<li><a href="./index.php?sort=flop">Flop</a></li>
<?php if($user->register){?>
		<li>Logged : <?php print $user->login; ?></li>
		<li><a href="./index.php?action=disconnect">disconnect</a></li>
<?php }else{?>
		<li><a href="./index.php?page=login">Login</a></li>
		<li><a href="./index.php?page=register">Register</a></li>
<?php }?>
	</ul>
	</div>
	<div id="info"><?php print Info::getInfo(); ?></div>
	<div id="error"><?php print Info::getError(); ?></div>
	<div id="contain"><?php
		if($_GET['page']=="addjoke"){
			include("page_addJoke.php");
		}elseif($_GET['page']=="register"){
			include("page_register.php");
		}elseif($_GET['page']=="login"){
			include("page_login.php");
		}elseif($_GET['page']=="don"){
			include("page_don.php");			
		}else{
			include("page_joke.php");
		}
		?>
	</div>
	
	<div id="footer">
		<p id="disclaimer">Toutes les citations présentes sur ce site ont été postées sous la responsabilité
		 exclusive des personnes nous les ayant soumises. Bodji, ne pouvant garantir cette origine,
		  n'endossera aucune plainte à ce sujet. :D .
		</p>
	</div>
</div>
</body>
</html>

<?php 
mysql_close($link);
?>